package com.medical.data.utils;

import cn.hutool.core.util.StrUtil;
import com.medical.data.config.RedisCache;
import com.medical.data.constEnum.RedisKeyConstants;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;

@Component
public class BLUtils {
    @Autowired
    private RedisCache redisCache;

    public BLUtils() {
    }

    public String BLCreate() {
        String redisKey = StrUtil.format(RedisKeyConstants.BLKEY, new Object[]{System.currentTimeMillis()});
        if (!ObjectUtils.isEmpty((Object[])this.redisCache.getCacheObject(redisKey))) {
            String bl = this.BLCreate();
            return bl;
        } else {
            this.redisCache.setCacheObject(redisKey, "true");
            return redisKey;
        }
    }
}
